
import React from 'react'
import { withRouter } from 'react-router-dom'
import './index.less'

class Login extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            array:['京','津','冀','晋','蒙','辽','吉','黑','沪','苏','浙','皖','闽','赣','鲁','豫','鄂','湘','粤','桂','琼','渝','川','贵','云','藏','陕','甘','青','宁']
        };
    }

    componentDidMount() {//每次进入登录页清除之前的登录信息

    }

    checkloca = (e) =>{
        this.props.carTextfun(e.currentTarget.childNodes[0].innerHTML)//这个地方把值传递给了props的事件当中
    }

    close = () => {
        this.props.carkeyfun(false)//这个地方把值传递给了props的事件当中
    }

    render() {
        return (
            <div>
                {
                    this.props.carkey?(
                        <div className="location" onClick={this.close}>
                            <div key="amache" className={'car  animate__animated animate__slideInUp animate__faster'}>
                                <ul>
                                    {this.state.array.map((item,index) =>
                                        <li key={index} onClick={this.checkloca}>
                                            <span>{item}</span>
                                        </li>
                                    )}
                                </ul>
                            </div>
                        </div>
                    ):null
                }
            </div>
        )
    }
}
export default withRouter(Login)
